﻿/* 
 * TABLE: dbo.Books 
 */

/* 
 * TABLE: Books 
 */

CREATE TABLE Books(
    BookId           int               IDENTITY(1,1),
    FileName         nvarchar(256)     NOT NULL,
    Avatar           nvarchar(256)     NULL,
    DateOfPublish    datetime2(0)      NOT NULL,
    ShortContent     nvarchar(1000)    NOT NULL,
    Title            nvarchar(256)     NOT NULL,
    UserId           int               NOT NULL,
    CONSTRAINT PK_Books PRIMARY KEY NONCLUSTERED (BookId)
)
GO
/* 
 * TABLE: dbo.Books 
 */

/* 
 * TABLE: Books 
 */

ALTER TABLE Books ADD CONSTRAINT FKUsers_Books 
    FOREIGN KEY (UserId)
    REFERENCES Users(UserId)